var t = require;
var e = module;
var o = exports;
var a,
    i =
        (this && this.__extends) ||
        ((a = function (t, e) {
            return (a =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                })(t, e);
        }),
        function (t, e) {
            a(t, e);
            function o() {
                this.constructor = t;
            }
            t.prototype = null === e ? Object.create(e) : ((o.prototype = e.prototype), new o());
        }),
    n =
        (this && this.__decorate) ||
        function (t, e, o, a) {
            var i,
                n = arguments.length,
                r = n < 3 ? e : null === a ? (a = Object.getOwnPropertyDescriptor(e, o)) : a;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, a);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (i = t[s]) && (r = (n < 3 ? i(r) : n > 3 ? i(e, o, r) : i(e, o)) || r);
            return n > 3 && r && Object.defineProperty(e, o, r), r;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var r = t("UIConfig"),
    s = t("UIManager"),
    c = t("GameEm"),
    p = t("ShopGroupItemBase"),
    l = cc._decorator,
    d = l.ccclass,
    u =
        (l.property,
        l.menu,
        (function (t) {
            i(e, t);
            function e() {
                var e = (null !== t && t.apply(this, arguments)) || this;
                e.spriteIcon = "";
                e.addCost1 = "0";
                return e;
            }
            e.prototype.onShowEnd = function () {
                this.updateList();
                this.node.active && this.checkView();
            };
            e.prototype.onLoad = function () {};
            e.prototype.checkView = function () {
                this._tip.$Label.string = this.tipNodeId;
                if (3 == this.checkList.length) for (var t = 0; t < 3; t++) this.setItem(t, this.checkList[t]);
                this.addCost1 = this.getAdd1Cost();
                this._rewardLab1.$Label.string = "" + ParseTool.parseAbc(this.addCost1);
                this._rewardLab2.$Label.string = "20m";
                this._rewardLab3.$Label.string = "5m";
            };
            e.prototype.setItem = function (t, e) {
                var o = CacheDataManager.getRewardKind(e.item_id),
                    a = t + 1;
                this["_tipLab" + a].$Label.string = "" + e.name;
                this["_rewardLab" + a].$Label.string = "" + this.getRewardData(t);
                SpriteView.setTaskSprite(this["_spriteCoin" + a].$Sprite, o.icon);
                this["_costLab" + a].$Label.string = "" + e.diamond_num;
            };
            e.prototype.getRewardData = function () {
                return "";
            };
            e.prototype._onItem1TouchEnd = function () {
                var t = this;
                console.log("ShopGroupItem05 ----------------- aa");
                if (CacheDataManager.checkCost(this.addCost1, "1")) {
                    var e = parseInt(this.checkList[0].diamond_num) || 0;
                    this.checkCost(e)
                        ? s.default.open(r.UIID.UIUseZs, {
                              cost: e,
                              cb: function () {
                                  var o = {
                                      resId: "20011",
                                      count: t.checkList[0].diamond_num,
                                      type: 1,
                                      tip: "4小时离线收益",
                                      tip2: ""
                                  };
                                  t.spriteIcon = t.allKeyList[0];
                                  var a = GameDataValue.getPropCount(c.PropKind.zhuanshi);
                                  GameDataValue.setPropCount(c.PropKind.zhuanshi, a - e);
                                  var i = t._item1.convertToWorldSpaceAR(cc.Vec2.ZERO);
                                  cc.v2(i).add(cc.v2(-300, 700));
                                  PayData.add4HDataCost(i, t.addCost1);
                                  EVUIEffView.emit(EVUIEffView.closeShop);
                                  QReport.send("220011");
                                  PayData.addLog(o.resId, o.count, o.type, [{id: 4, num: t.addCost1}], o.tip, o.tip2);
                              }
                          })
                        : s.default.open(r.UIID.UIToast, {msg: "钻石不足"});
                } else s.default.open(r.UIID.UIToast, {msg: "利润为0"});
            };
            e.prototype.getAdd1Cost = function () {
                for (
                    var t = CacheDataManager.getAllAddCost(),
                        e = CacheDataManager.getLevelChapterMul(GameDataValue.getLastLv()),
                        o = Math.floor(1440 * e),
                        a = CacheDataManager.mulCost(t, o + "");
                    "0" != a && "0" == a[0];

                )
                    a = a.substring(1, a.length);
                return "0" == a || "00" == a ? "0" : a;
            };
            e.prototype._onItem2TouchEnd = function () {
                var t = this,
                    e = parseInt(this.checkList[1].diamond_num) || 0;
                this.checkCost(e)
                    ? s.default.open(r.UIID.UIUseZs, {
                          cost: e,
                          cb: function () {
                              var o = {resId: "20012", count: e, type: 1, tip: "2倍收入：20分钟", tip2: ""},
                                  a = GameDataValue.getPropCount(c.PropKind.zhuanshi);
                              GameDataValue.setPropCount(c.PropKind.zhuanshi, a - e);
                              t.spriteIcon = t.allKeyList[1];
                              var i = t._item2.convertToWorldSpaceAR(cc.Vec2.ZERO),
                                  n = cc.v2(i).add(cc.v2(-300, 700));
                              EVUIEffView.emit(EVUIEffView.movePropSpriteIcon, i, n, t.spriteIcon);
                              PayData.setCostMul20(2);
                              EVUIEffView.emit(EVUIEffView.closeShop);
                              EVUIEffView.emit(EVUIEffView.updateAddMulAd);
                              EVUIEffView.emit(EVUIEffView.addTipCom2, t.spriteIcon);
                              QReport.send("220012");
                              PayData.addLog(o.resId, o.count, o.type, [], o.tip, o.tip2);
                          }
                      })
                    : s.default.open(r.UIID.UIToast, {msg: "钻石不足"});
            };
            e.prototype._onItem3TouchEnd = function () {
                var t = this,
                    e = parseInt(this.checkList[2].diamond_num) || 0;
                this.checkCost(e)
                    ? s.default.open(r.UIID.UIUseZs, {
                          cost: e,
                          cb: function () {
                              var o = {resId: "20013", count: e, type: 1, tip: "5倍收入：5分钟", tip2: ""};
                              t.spriteIcon = t.allKeyList[2];
                              var a = t._item3.convertToWorldSpaceAR(cc.Vec2.ZERO),
                                  i = cc.v2(a).add(cc.v2(-300, 700)),
                                  n = GameDataValue.getPropCount(c.PropKind.zhuanshi);
                              GameDataValue.setPropCount(c.PropKind.zhuanshi, n - e);
                              PayData.setCostMul5(5);
                              EVUIEffView.emit(EVUIEffView.movePropSpriteIcon, a, i, t.spriteIcon);
                              EVUIEffView.emit(EVUIEffView.closeShop);
                              EVUIEffView.emit(EVUIEffView.updateAddMulAd);
                              EVUIEffView.emit(EVUIEffView.addTipCom2, t.spriteIcon);
                              QReport.send("220013");
                              PayData.addLog(o.resId, o.count, o.type, [], o.tip, o.tip2);
                          }
                      })
                    : s.default.open(r.UIID.UIToast, {msg: "钻石不足"});
            };
            e.prototype.checkCost = function (t) {
                return GameDataValue.getPropCount(c.PropKind.zhuanshi) >= t;
            };
            return n([d], e);
        })(p.default));
o.default = u;
